Skip to content

Add Azure Monitor Workspace metrics provider - #1954

Open
chriscur wants to merge 1 commit into
fluxcd:mainfrom
chriscur:chriscur/azure-monitor-workspace-provider
Open

Add Azure Monitor Workspace metrics provider#1954
chriscur wants to merge 1 commit into
fluxcd:mainfrom
chriscur:chriscur/azure-monitor-workspace-provider

Conversation

@chriscur

Copy link
Copy Markdown

Add an azuremonitor metric template provider that queries the managed Prometheus endpoint of an Azure Monitor Workspace, removing the need to front the workspace with an aad-auth-proxy sidecar.

The provider embeds the Prometheus provider and only takes care of authentication. It resolves a Microsoft Entra ID token before each query and hands it to the Prometheus provider as a bearer token, so query handling, headers and error reporting stay unchanged.

The identity is taken from the values present in the referenced secret. A clientId and tenantId pair selects a workload identity, adding a clientSecret selects a service principal, and an absent secret falls back to the workload identity of the Flagger pod. The Azure cloud and the token audience are derived from the workspace host name, so no new provider fields or controller flags are needed.

The address is required to be an HTTPS Azure Monitor Workspace query endpoint and insecureSkipVerify is rejected, so that the token is only ever sent to a verified workspace host.

@chriscur

chriscur commented Jul 29, 2026

Copy link
Copy Markdown
Author

This change is ready for review. I'm currently running it on my dev/test clusters to get some real-world usage out of it.
The testing in my dev/test environment against real services in the pipeline to production came back good.

@devigned devigned left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From an Azure Golang SDK and auth perspective, token construction and usage lgtm.

@codecov-commenter

codecov-commenter commented Aug 2, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 88.50575% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.35%. Comparing base (122fe97) to head (f9d5b71).
⚠️ Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
pkg/metrics/providers/azuremonitor.go 90.58% 4 Missing and 4 partials ⚠️
pkg/metrics/providers/factory.go 0.00% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1954      +/-   ##
==========================================
+ Coverage   29.78%   30.35%   +0.57%     
==========================================
  Files         288      289       +1     
  Lines       18591    18728     +137     
==========================================
+ Hits         5537     5685     +148     
+ Misses      12325    12302      -23     
- Partials      729      741      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aryan9600 aryan9600 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good apart from a couple of nits

Comment thread pkg/metrics/providers/azuremonitor.go
Comment thread docs/gitbook/usage/metrics.md Outdated
Add an `azuremonitor` metric template provider that queries the managed
Prometheus endpoint of an Azure Monitor Workspace, removing the need to
front the workspace with an aad-auth-proxy sidecar.

The provider embeds the Prometheus provider and only takes care of
authentication. It resolves a Microsoft Entra ID token before each query
and hands it to the Prometheus provider as a bearer token, so query
handling, headers and error reporting stay unchanged.

The identity is taken from the keys present in the referenced secret. A
clientId and tenantId pair selects a workload identity, adding a
clientSecret selects a service principal, and an absent secret falls back
to the workload identity of the Flagger pod. The Azure cloud and the
token audience are derived from the workspace host name, so no new
provider fields or controller flags are needed.

The address is required to be an HTTPS Azure Monitor Workspace query
endpoint and insecureSkipVerify is rejected, so that the token is only
ever sent to a verified workspace host.

Signed-off-by: Chris Curwick <chriscur@microsoft.com>
@chriscur
chriscur force-pushed the chriscur/azure-monitor-workspace-provider branch from f9d5b71 to 3bacc1f Compare August 3, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants